// Implementation of model broker
// Copyright 2004 (C) Ralph Thomas

#include <model/model.h>
#include <model/file/fileFactory.h>
#include <model/http/httpFactory.h>

namespace model {
	model::~model() {
		//
		// XXX: if factory refcounts are implemented then
		// XXX: the refcount of the creating factory should
		// XXX: be decreased here (so that the factory can
		// XXX: be unloaded when all the models it made are
		// XXX: done).
		//
	}

	model* model::fromString( util::string serialized ){
		//
		// Create test, file or IMAP models.
		//
		fileFactory ff;
		httpFactory hf;
		model* m = ff.fromString( serialized );
		if( m ) return m;
		return hf.fromString( serialized );
	}
};

